/*
package com.ruibo.tax.mq.listener;

import com.ibm.jms.JMSBytesMessage;
import com.ibm.mq.MQMessage;
import com.ruibo.tax.mq.receive.DZQLSW2HBTask;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsOperations;
import org.springframework.jms.listener.adapter.MessageListenerAdapter;
import org.springframework.stereotype.Component;

import javax.jms.Message;
import java.io.File;
import java.io.RandomAccessFile;


@Slf4j
@Component
public class QLHB2SWListener  extends MessageListenerAdapter {
    @Autowired
    JmsOperations jmsOperations;

    @Autowired
    private DZQLSW2HBTask dzqlsw2HBTask;

    @Override
    @JmsListener(destination = "QLHB2SW")
    public void onMessage(Message message) {
        log.info("监听队列收到消息");
        try {  //JmsListener收到消息后，会自动封装成自己特有的数据格式，可以用TextMessage来解析原始消息
            JMSBytesMessage msg = (JMSBytesMessage) message;
            long bodyLength = msg.getBodyLength();

            log.info("获取到对账数据的长度为,{}", bodyLength);


            int messageLength = new Long(bodyLength).intValue();


            log.info("获取到对账数据的长度为,{}", messageLength );
            byte[] msgData = new byte[messageLength];
            msg.readBytes(msgData);
            //这里曾经用流直接处理  但是有问题解决不掉  所以出此下策

            System.out.println(new String(msgData));


            RandomAccessFile accessFile = new RandomAccessFile(new File("c:/b.zip"), "rw");
            accessFile.write(msgData, 0, messageLength);
            accessFile.close();
            dzqlsw2HBTask.readZipFile("c:/b.zip");

        } catch (Exception e) {
            log.error("从队列BS002中接收消息异常！{}", e.toString());
        }
    }
}
*/
